package pl.edu.agh.nn.functions;

public class ThresholdFunction implements IActivationFunction {

	private static final ThresholdFunction instance = new ThresholdFunction();
	private double threshold;

	public static ThresholdFunction getInstance() {
		return instance;
	}

	private ThresholdFunction() {

	}

	@Override
	public double compute(double x) {
		return x < threshold ? 0 : 1;
	}

	@Override
	public double deriveComputation(double x) {
		return 0.0;
	}

	public double getThreshold() {
		return threshold;
	}

	public void setThreshold(double threshold) {
		this.threshold = threshold;
	}

}
